<template>
  <!-- 物资采购计划详情 -->
  <div class="e-form">
    <div class="tabs" v-if="Object.keys(basicFormData).length != 0" warningTabs>
      <el-tabs tab-position="left" v-model="tabsName" @tab-click="onChangeTab">
        <!-- 基本信息 -->
        <el-tab-pane
          label="基本信息"
          name="baseInfo"
          :disabled="clickTabFlag"
        ></el-tab-pane>
        <el-tab-pane
          label="物资明细"
          name="goodsAndMaterials"
          :disabled="clickTabFlag"
        ></el-tab-pane>

        <el-tab-pane
          label="附件信息"
          name="accessory"
          :disabled="clickTabFlag"
        ></el-tab-pane>
        <el-tab-pane
          label="审核历史"
          name="auditHistory"
          :disabled="clickTabFlag"
        ></el-tab-pane>
        <el-tab-pane
          label="变更历史"
          name="alteration"
          :disabled="clickTabFlag"
        ></el-tab-pane>

        <div>
          <!-- 基本信息 -->
          <div id="baseInfoCon" class="con">
            <div class="e-form">
               <BillTop title="物资采购计划详情" @cancel="handleClose"></BillTop>
              <div class="tabs">
                <div class="tabs-title" id="baseInfo">基本信息</div>
                <div style="width: 100%" class="form">
                  <el-form
                    :model="basicFormData"
                    label-width="150px"
                     ref="ruleForm"
                    :rules="rules"
                    class="demo-ruleForm"
                  >
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="采购计划编号：">
                          {{basicFormData.billNo}}
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="单据机构：">
                          {{ basicFormData.orgName }}
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                         <el-col :span="12">
                            <el-form-item label="计划日期：" >
                            {{basicFormData.planDate}}
                             </el-form-item>

                      </el-col>
                         <el-col :span="12">
                        <el-form-item label="币种：" >
                            {{basicFormData.currency}}

                        </el-form-item>
                      </el-col>

                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          label="不含税计划金额(元)："
                          v-model="basicFormData.amount"
                        >
                          <!-- 汇总物资明细市场金额，保留两位小数，不可修改 -->
                          {{ basicFormData.amount.toFixed(2) }}
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="税率%：" >
                            {{basicFormData.taxRate}}

                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item
                          label="计划金额(元)："
                          v-model="basicFormData.totalAmount"
                        >
                          <!-- 数字框，保留2位小数，不含税计划金额+税额。  -->
                          {{ basicFormData.totalAmount }}
                        </el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="税额：">
                            {{basicFormData.taxAmount}}

                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>

                      <el-col :span="12">
                        <el-form-item
                          label="状态："
                          v-model="basicFormData.state"
                        >
                          {{
                            ["草稿", "审核中", "已审核", "已关闭", '',"已作废"][
                              basicFormData.state
                            ]
                          }}
                        </el-form-item>
                      </el-col>

                    </el-row>
                      <el-row>
                        <el-form-item label="项目情况说明：">
                       {{basicFormData.projectDescription}}
                        </el-form-item>
                    </el-row>
                    <el-row>
                      <el-form-item label="备注：">
                        {{basicFormData.remarks}}

                      </el-form-item>
                    </el-row>

                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="填报人：">{{
                          basicFormData.preparer
                        }}</el-form-item>
                      </el-col>
                      <el-col :span="12">
                        <el-form-item label="本位币：">
                          {{ basicFormData.baseCurName }}
                        </el-form-item>
                      </el-col>
                    </el-row>
                    <el-row>
                      <el-col :span="12">
                        <el-form-item label="本位币汇率：">
                          <span v-if="basicFormData.baseCurRate === 1">  {{ basicFormData.baseCurRate }}</span>
                          <span v-else>
                            <el-input
                              placeholder="请输入本位币汇率"
                              v-model="basicFormData.baseCurRate"
                            >
                            </el-input>
                              </span>
                          </el-form-item>
                        <!-- 单据金额 * 本位币汇率 -->
                        <!-- <el-form-item label="计划金额（本位币）">
                          {{ basicFormData.baseCurAmount }}
                        </el-form-item> -->
                      </el-col>
                      <el-col :span="12">
                      <!-- <el-form-item label="人民币汇率：">
                        <span>{{ basicFormData.rmbRate }}</span>
                        </el-form-item> -->
                    </el-col>
                    </el-row>
                    <el-row>

                        </el-row>
                  </el-form>
                </div>
              </div>
            </div>

            <!-- ------------------------------------------------------------------------------------- -->
          </div>

          <!-- 物资明细 -->
          <div id="goodsAndMaterialsCon" class="con">
            <div class="tabs-title" id="goodsAndMaterials">物资明细</div>
            <div class="e-table">

              <el-table
                :data="goodsAndMaterialsList"
                border
                style="width: 100%"
                @selection-change="planTableSelect"
                :row-class-name="tableRowClassName"
                :cell-class-name="cellClsNm"
                :header-cell-style="{ textAlign: 'center' }"
                :cell-style="{ textAlign: 'center' }"
                :tree-props="{
                  children: 'children',
                  hasChildren: 'hasChildren',
                }"
                row-key="uuid"
                :max-height="$store.state.tableHeight"
              >
                <el-table-column
                  label="操作"
                  fixed
                  width="100px"
                  align="left"
                  v-if="isDel"
                >

                </el-table-column>
                <el-table-column
                  prop="materialClassName"
                  label="物资类别"
                  min-width="200"
                  align="left"
                >
                  <!-- <template slot-scope="{ row }">
                        {{ row.topClassId ? row.materialClassName : (!row.customId.includes('-') ? row.materialClassName : '') }}
                    </template> -->
                </el-table-column>
                <el-table-column
                  prop="materialName"
                  label="物资名称"
                  width="100"
                >
                </el-table-column>
                <el-table-column prop="spec" label="规格型号" width="100">
                </el-table-column>
                <el-table-column prop="unit" label="计量单位" width="100">
                </el-table-column>
                <el-table-column prop="texture" label="材质" width="150">

                </el-table-column>
                <el-table-column
                  prop="quantity"
                  label="数量"
                  width="150"
                >

                </el-table-column>

                <el-table-column
                  prop="price"
                  label="单价（元）"
                  width="130"
                >
                </el-table-column>
                <el-table-column
                  prop="amount"
                  label="计划金额（元）"
                  width="130"
                >
                  <!-- 系统计算，计划数量*预算单价，不可编辑，保留两位小数 -->
                </el-table-column>

                <el-table-column
                  prop="purchaseType"
                  label="采购方式"
                  width="150"
                >
                  <template slot-scope="{ row }">
                          <span>{{
                          ["邀请招标", "公开招标","询价","竞争性谈判","单一性来源","产业协同"][row.purchaseType]
                          }}</span>
                      </template>

                </el-table-column>
                 <el-table-column
                  prop="intoTime"
                  label="进场时间"
                  width="200"
                >
                </el-table-column>

              </el-table>
            </div>
          </div>
          <!-- 附件信息 -->
          <div id="accessoryCon" class="con">
            <div class="tabs-title" id="accessory">附件信息</div>
             <attach-comp
              :relationId="attachId"
              bucketName="material"
              v-if="objFlag.flag5"
              ref="attachComp"
            />
            <div class="seize-a-seat" v-else>
              <i class="el-icon-loading"></i>
            </div>
          </div>
          <!-- 审核历史 -->
           <div id="auditHistoryCon" class="con">
              <div class="tabs-title" id="auditHistory">审核历史</div>
              <div class="e-table">
                  <ComAuditHistoryIndex
                      :tableData.sync="auditHistoryTable"
                      @getAuditHistory="getAuditHistory"
                      ref="AuditHistoryRef"
                  />
              </div>
          </div>
          <!-- 变更历史 -->
          <div id="alterationCon" class="con">
            <div class="tabs-title" id="alteration">变更历史</div>
            <div class="e-table">
              <el-table
                :data="changeData"
                border
                style="width: 100%"
                :cell-class-name="cellClsNm"
                :header-cell-style="{ textAlign: 'center' }"
                :cell-style="{ textAlign: 'center' }"
              >
                <el-table-column prop="period" label="变更期数" width="80">
                </el-table-column>
                <el-table-column prop="billNo" label="变更编号" min-width="400">
                  <template slot-scope="scope">
                    <span
                      @click="click(scope.row.billId,scope.row.state)"
                      style="color: blue; cursor: pointer"
                    >
                      {{ scope.row.billNo }}
                    </span>
                  </template>
                </el-table-column>
                <el-table-column prop="planDate" label="变更时间" width="200">
                </el-table-column>
                <el-table-column
                  prop="amount"
                  label="原计划金额（元）"
                  width="200"
                >
                </el-table-column>
                <el-table-column
                  prop="amountChange"
                  label="变更金额（元）"
                  width="200"
                >
                </el-table-column>
                <el-table-column
                  prop="amountChanged"
                  label="变更后计划金额（元）"
                  width="200"
                >
                </el-table-column>
                <el-table-column prop="state" label="状态" width="200">
                  <template slot-scope="scope">
                    <span>
                      {{
                        ["草稿", "审核中", "已审核", "已关闭",'', "已作废"][
                          scope.row.state
                        ]
                      }}
                    </span>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </div>
        </div>
      </el-tabs>
    </div>
    <div id="seat" :style="{ height: seatHeight + 'px' }"></div>
     <div class="buttons">
              <el-button
        type="primary"
        size="small"
        style="background: #2e61d7"
        @click="alteration"
        v-if="basicFormData.state === '2'"
        v-debounce
        >变更</el-button
      >
       <!-- <el-button
        type="primary"
        size="small"
        style="background: #2e61d7"
        v-if="basicFormData.state === '1'"
        v-debounce
        @click="Print"
        >打印</el-button
      > -->
      <el-button
        type="primary"
        size="small"
        style="background: #2e61d7"
        v-if="basicFormData.state === '1'"
        v-debounce
        @click="audit"
        >审核</el-button
      >
        <el-button
        type="primary"
        size="small"
        style="background: #2e61d7"
        @click="undoAudit"
        v-if="basicFormData.state === '1'"
        v-debounce
        >撤回</el-button
      >
       <el-button
        type="primary"
        size="small"
        style="background: #2e61d7"
        @click="nullify()"
        v-if="basicFormData.state === '1'"
        v-debounce
        >作废</el-button
      >
      <el-button size="small" @click="handleClose">关闭</el-button>
        </div>
  </div>
</template>

<script>
import '@/utils/jquery.scrollTo.min'
import { mapMutations, mapState } from 'vuex'
import {  getUuid, openAppClient  } from '@/utils/common'
import AttachComp from '@/components/common/attachIndex'
import request from '@/api/materials/plan.js'
import $ from 'jquery'
import CommonApi from '@/api/materials/common.js'
import ComAuditHistoryIndex from '@/pages/materialsmanagement/components/auditHistory/auditHistoryIndex'
export default {
    data () {
        return {
            tabsName: 'baseInfo',
            userName: '',
            // selectData: false,
            form: {
                name: '',
                region: '',
                date1: '',
                date2: '',
                delivery: false,
                type: [],
                resource: '',
                desc: '',
            },
            errorList: [], //控制导航栏感叹号的显示
            errorMsg: [],
            isErrorMsg: true, //是否提醒错误信息
            isBatch: true, //是否进入批量操作
            batch: '进入批量管理',
            tableData: [],
            changeData: [],
            goodsAndMaterialsList: [], //明细
            planSelect: [], //计划明细选择项
            auditHistoryTable: [], //审核历史
            value: '',
            textarea: '',
            formData: {},
            auditState: {},
            data: [], //
            screenWidth: 0,
            screenHeight: 0,
            lastConHeight: 0,
            clickTabFlag: false, // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            //基本信息表单数据
            basicFormData: {

            },
            objFlag: {
                flag5: false,
            },
            selectEquipVisible: false,
            moneyList: [], //币种
            orgId: '', //机构id
            orgName: '', //机构名称
            userId: '', //当前用户id
            billId: '',
            isSkip: false, //是否跳转
            hideen: false,
            dtlId1: '',
            dtlId2: '',
            isDel: true,
            designQuantitys: 0,
            auditParams: {
                billId: this.$route.query.billid, //单据Id  ***
                billType: '1038', //单据编码  ***
                dtls: [], //审核中字段值变更历史
                freeNextUnitIndex: 0, //下一步审核步骤
                freeNextUser: '', //下一步审核人ID
                isPass: true, //审核是否通过
                isShareInAudit: true, //是否共享审核节点
                opinion: '', //审核意见   ***
                orgId: JSON.parse(localStorage.getItem('vuex')).userInfo.orgInfo.orgId, //单据机构Id
                orgName: JSON.parse(localStorage.getItem('vuex')).userInfo.orgInfo.orgName, //单据机构名称
                userId: localStorage.getItem('userId'), //审核人Id    ***
                workId: '', //流程Id
            },
            nullifyParams: { //作废
                'billId': this.$route.query.billid,
                'billType': 1038,
                'nullifyCreated': '',
                'nullifyCreator': '',
                'nullifyCreatorId': '',
                'nullifyDescription': '',
                'nullifyReason': ''
            },
            procurementMethod: [{
                value: 0,
                label: '邀请招标'
            }, {
                value: 1,
                label: '公开招标'
            }, {
                value: 2,
                label: '询价'
            }, {
                value: 3,
                label: '竞争性谈判'
            }, {
                value: 4,
                label: '单一性来源'
            },
            {
                value: 5,
                label: '产业协同'
            }],
            //

        }
    },
    computed: {
        ...mapState({
            userInfo: state => state.userInfo,
            currencyForm: state => state.equip.equipData.currencyForm, //币种
            options: state => state.contract.ctClassify,

        }),

        judgeRoute () {
            if (this.$route.path.includes('Add')) {
                return false
            }
            return true
        },
        // 填补底部空白，以使高度够滚动
        seatHeight () {
            return this.screenHeight - 72 - this.lastConHeight
        },
        attachId () {
            return this.billid
        },

    },
    watch: {
        //给错误标签加上提醒
        errorList: newData => {
            const tabs = document.querySelectorAll('.el-tabs__item')
            tabs.forEach(DOM => {
                const { childNodes } = DOM
                if (childNodes.length > 1) {
                    DOM.removeChild(childNodes[1])
                }
            })
            newData.forEach(item => {
                const itemDom = document.querySelector(`#tab-${item}`)
                var element = document.createElement('i')
                element.className = 'el-icon-warning-outline warning'
                itemDom.appendChild(element)
            })
        },
    },
    components: {
        AttachComp,
        ComAuditHistoryIndex,
    // selectData,
    },
    created () {
        let data = JSON.parse(localStorage.getItem('vuex'))
        this.basicFormData.orgId = data.userInfo.orgInfo.orgId
        this.basicFormData.orgName = data.userInfo.orgInfo.orgName
        this.basicFormData.userId = localStorage.getItem('userId')
        this.userName = localStorage.getItem('userName')
        this.userId = localStorage.getItem('userId')
        this.billid = this.$route.query.billid
        this.getBasicData() //进入页面就获取基本信息数据
        this.getchangeData()
        this.getAttach()
        this.getMasterPlan() //明细数据

    },
    mounted () {
    // 获取最后一个内容区域的高度，计算底部空白
        this.getLastConHeight()

        // 保存所有tabName
        const arr = [
            'baseInfo',
            'goodsAndMaterials',
            'accessory',
            'auditHistory',
            'alteration',
        ]
        this.tabArr = arr //标星星
        let $idsTop = []
        window.addEventListener('scroll', () => {
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            if (this.clickTabFlag) {
                return
            }

            if (!$idsTop[$idsTop.length - 1]) {
                $idsTop = arr.map(item => {
                    const $item = document.getElementById(item)
                    let itemTop = null
                    if ($item) {
                        itemTop = $item.offsetTop
                    }
                    return itemTop
                })
            }
            const scrollTop =
        document.documentElement.scrollTop || document.body.scrollTop
            // 倒序查找
            let curLocal = 0
            for (let len = $idsTop.length, i = len - 1; i >= 0; i--) {
                let item = $idsTop[i]
                if (scrollTop + 1 >= item) {
                    curLocal = i
                    break
                }
            }
            // 设置对应tabName
            this.tabsName = arr[curLocal]
        })

        this.screenWidth = document.documentElement.clientWidth - this.topHeight
        this.screenHeight = document.documentElement.clientHeight - this.topHeight
        window.addEventListener('resize', () => {
            this.screenWidth = document.documentElement.clientWidth - this.topHeight
            this.screenHeight = document.documentElement.clientHeight - this.topHeight
            $idsTop = arr.map(item => {
                const itemTop = document.getElementById(item).offsetTop
                return itemTop
            })
        })
        this.scorllDtl()
    },
    methods: {
        ...mapMutations(['setSelectedInfo', 'setAuditParams']),
        //作废
        nullify () {
            this.setAuditParams(this.nullifyParams)
            openAppClient('/nullifyDialog', '单据作废原因', () => {
                const auditParams = JSON.parse(localStorage.vuex).auditParams
                CommonApi.nullify(auditParams).then(() => {
                    this.clientPop('suc', '作废成功', this.handleClose, null, this.handleClose)
                })
            })
        },

        //跳转到明细
        scorllDtl () {
            if(this.$route.query.name) {
                setTimeout(() => {
                    //因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                    let obj = {
                        name: this.$route.query.name
                    }
                    this.tabsName = this.$route.query.name
                    this.onChangeTab(obj)
                }, 200)
            }
        },

        //汇总汇总税额

        //批量管理
        batchOperation () {
            this.isBatch = !this.isBatch
            if (this.isBatch) {
                this.batch = '退出批量管理'
                // this.$refs.table.clearSelection()
            } else {
                this.batch = '进入批量管理'
            }
        },

        count_ (obj) {
            return obj.children.reduce((prev, c) => (prev += c.amount || 0), 0)
        },

        //明细数据汇总方法
        uniqueArray (arr, key) {
            const map = new Map()
            return arr.filter(item => {
                const val = item[key] + '' || getUuid()
                return !map.has(val) && map.set(val, 1)
            })
        },

        ...mapMutations(['setPopConfirm']),
        //查询附件信息
        getAttach () {
            this.objFlag.flag5 = true
        },

        //获取基本信息数据
        getBasicData () {
            this.$Ajax
                .httpGet({
                    url: '/material/purchasePlan/findById',
                    params: {
                        id: this.billid,
                    },
                })
                .then(res => {
                    this.basicFormData = res
                    this.countMarketAmount()
                    this.countTaxAmount()
                })
        },
        //获取明细数据
        getMasterPlan () {
            this.$Ajax
                .httpGet({
                    url: '/material/purchasePlan/getListById',
                    params: {
                        id: this.billid,
                    },
                })
                .then(res => {
                    res.forEach(item => {
                        item.materialClassName = item.topClassName
                        item.uuid = getUuid()
                        item.children.forEach(i => {
                            i.uuid = i.dtlId
                        })
                        const count = item.children.reduce(
                            (prev, c) => (prev += c.marketAmount || 0),
                            0
                        )
                        item.materialName = `小计： ${count.toFixed(2)}`
                    })
                    this.goodsAndMaterialsList = res

                    this.countMarketAmount()
                    this.countTaxAmount()
                    console.log('this.goodsAndMaterialsList', this.goodsAndMaterialsList)

                })
        },
        //获取变更历史列表数据
        getchangeData () {
            this.$Ajax
                .httpPost({
                    url: '/material/purchasePlanChange/listByEntity',
                    params: {
                        limit: 10,
                        masterPlanBillId: this.billid,
                        page: 1,
                    },
                })
                .then(res => {

                    this.changeData = res.list
                })
        },
        //获取历史审核列表
        getAuditHistory () {
            const params = {
                billId: this.billid,
                billType: '1038',
                freeNextUnitIndex: 0,
                freeNextUser: '',
                isPass: true,
                isShareInAudit: true,
                opinion: '',
                orgId: '',
                orgName: '',
                userId: '',
                workId: ''
            }
            request.getAuditHistory(params).then(res => {
                this.auditHistoryTable = res
            })
        },
        // 获取最后一个内容区域的高度，计算底部空白
        getLastConHeight () {
            let si = setInterval(() => {
                // 因为dom异步加载，通过轮询找到渲染后的dom，获取高度
                if (document.getElementById('evaluateCon')) {
                    const lastConHeight =
            document.getElementById('evaluateCon').offsetHeight
                    console.log('lastConHeight: ', lastConHeight)
                    this.lastConHeight = lastConHeight
                    console.log('this.lastConHeight', this.lastConHeight)
                    clearInterval(si)
                    si = null
                }
            }, 100)
        },
        //审核
        audit () {
            this.setAuditParams(this.auditParams)
            // 客户端弹窗弹出本地页面
            openAppClient('/exaDialog', '填写审核意见', () => {
                const auditParams = JSON.parse(localStorage.vuex).auditParams
                request.audit(auditParams).then(() => {
                    this.clientPop('suc', '审核成功', this.handleClose, null, this.handleClose)
                })
            })
        },

        //撤回
        undoAudit () {
            const params2 = {
                billId: this.billid, //单据Id  ***
                billType: '1038', //单据编码  ***
                dtls: [], //审核中字段值变更历史
                freeNextUnitIndex: 0, //下一步审核步骤
                freeNextUser: '', //下一步审核人ID
                isPass: true, //审核是否通过
                isShareInAudit: true, //是否共享审核节点
                opinion: '', //审核意见   ***
                orgId: '', //单据机构Id
                orgName: '', //单据机构名称
                userId: this.userId, //审核人Id    ***
                workId: '', //流程Id
            }
            request.undoAudit(params2).then(() => {
                this.clientPop('suc', '撤回成功！', this.handleClose,)
            })
        },

        handleFullScreen () {
            this.fullscreen = !this.fullscreen
        },
        //变更
        alteration () {
            let billid = this.$route.query.billid
            this.$Ajax
                .httpGet({
                    url: '/material/masterPlanChanged/theBillBeingChanging',
                    params: {
                        billId: billid,
                    },
                }).then(res=>{
                    if(res.code) {
                        this.$router.push({
                            path: '/materialsProcurementPlanChangeAdd',
                            query: { billid }
                        })
                    }else{
                        this.clientPop('err', '已存在草稿/审核中的变更，不允许发起新的变更！')
                    }

                })
        },
        //点击编号
        click (billid, state) {

            if(state == -1 || state == 2 || state == 5 ) {
                this.$router.push({
                    path: '/materialsProcurementPlanChangeDetails',
                    query: { billid },
                })
            }else {
                request.getCurrentUnitInfo({
                    'billId': billid,
                    'billType': '10381',
                    'freeNextUnitIndex': 0,
                    'freeNextUser': '',
                    'isPass': true,
                    'isShareInAudit': true,
                    'opinion': '',
                    'orgId': '',
                    'orgName': '',
                    'userId': '',
                    'workId': ''
                })
                    .then(res=>{
                        if(res.canModify) {
                            this.$router.push({
                                path: '/materialsProcurementPlanChangeEdit',
                                query: { billid, res },
                            })
                        }else{
                            this.$router.push({
                                path: '/materialsProcurementPlanChangeDetails',
                                query: { billid },
                            })
                        }
                    })
            }

        },
        //取消
        handleClose () {
            this.dialogVisible = false
            this.$router.replace('/materialsProcurementPlan')
        },
        cellClsNm ({ column }) {
            if (column.label === '') {
                return 'fixed-left'
            }
        },

        onChangeTab (e) {
            console.log('clickTabFlag: ', this.clickTabFlag)
            $.scrollTo(`#${e.name}`, 500)
            // 如果手动点击时，则不做滚动事件逻辑，只有滚动屏幕时才走滚动事件逻辑
            this.clickTabFlag = true
            // 动画结束后，恢复状态
            setTimeout(() => {
                this.clickTabFlag = false
            }, 600)
        },

        //获取计划明细表格的选择项
        planTableSelect (selection) {
            this.planSelect = selection
        },
        //删除物资明细
        deleteEle (row) {
            row.changeType = -1
        },
        // 打开客户端弹窗，调用客户端api
        openApp () {
            window.getPopData = this.getPopData // 向客户端开放全局变量，让客户端在关闭弹窗时回调并传递回数据
            callbackObj.changeLoadingState(true) // ChangeLoadingState为客户端提供打开loading的方法

            // 本地模拟ajax异步，编写业务代码时修改为ajax
            setTimeout(() => {
                callbackObj.changeLoadingState(false) // 调用客户端api关闭loadin
                callbackObj.openWindow('/search') // OpenWindow为客户端提供打开弹窗的方法
            }, 2000)
        },
        // 接收客户端回调数据的方法
        getPopData (msg) {
            // 接收弹窗关闭时的form表单数据，并处理业务逻辑
            alert(`getPopData: ${msg}`)

            window.getPopData = null // 释放全局变量
        },
        //获取当前时间
        geyDate () {
            var myDate = new Date()
            return myDate
        },
    },
}
</script>

<style lang="scss">
.buttons {
  left: 0;
}
.e-form {
  margin-bottom: 80px;
  padding: 0 20px;
  .tabs-title::before {
    content: "";
    height: 22px;
    width: 8px;
    border-radius: 40px;
    background-color: #2e61d7;
    display: block;
    position: absolute;
    left: 20px;
    margin-right: 20px;
  }
}

.e-table {
  background: #fff;
  .totoal {
    margin-left: 10px;
    cursor: pointer;
    color: blue;
  }
}
.el-table .warning-row {
  display: none;
}
// ::v-deep.el-table__body-wrapper::-webkit-scrollbar{
//      width: 6px !important; // 横向滚动条
//     height: 10px !important// 纵向滚动条
// }

::v-deep .el-table__body-wrapper::-webkit-scrollbar {
  width: 6px; // 横向滚动条
  height: 10px; // 纵向滚动条
}
// 滚动条的滑块
::v-deep .el-table__body-wrapper::-webkit-scrollbar-thumb {
  background-color: #ddd;
  border-radius: 5px;
}

.el-tab-pane {
  margin-left: -10px;
}
</style>
